home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / Ang261Lib.lha / src / config.h < prev    next >
C/C++ Source or Header  |  1994-10-22  |  11KB  |  365 lines

  1. /* config.h: configuration definitions
  2.  *
  3.  * Copyright (c) 1989 James E. Wilson
  4.  *
  5.  * This software may be copied and distributed for educational, research, and
  6.  * not for profit purposes provided that this copyright and statement are
  7.  * included in all such copies.
  8.  */
  9.  
  10. /* Person to bother if something goes wrong.
  11.  * Recompile files.c and misc2.c if these change.
  12.  */
  13.  
  14. #define WIZARD    "root"
  15.  
  16. /* There's a bug that results in invisible monsters for some reason.  I have a
  17.  * workaround that may fix this, but it is a HACK and may result in other
  18.  * problems, as I have not tested it enough.  Comment out the
  19.  * "#define GROSS_HACK" to disable this.  (this is in creature.c at line 73)
  20.  ******
  21.  * This should no longer be needed for Angband 2.6, but it doesn't hurt to
  22.  * leave it in. -CWS
  23.  */
  24.  
  25. #define GROSS_HACK
  26.  
  27.  
  28. /* Other miscellaneous defines that can be configured as the local maintainer
  29.  * wishes.
  30.  */
  31.  
  32. #define SET_UID                 /* define on multi-user systems                 */
  33. #undef CHECKHOURS            /* define if checking the 'hours' file          */
  34. #define ALLOW_FIDDLING       /* Allow the players to copy save files         */
  35. #define ALLOW_SCORE          /* Allow the user to check his score (v-key)    */
  36. #define ALLOW_ARTIFACT_CHECK /* Allow the user to check artifacts            */
  37. #define ALLOW_CHECK_UNIQUES  /* Allow player to check (dead) unique monsters */
  38. #define TARGET               /* Enable targeting mode                        */
  39. #define AUTOROLLER           /* Allow autorolling of characters              */
  40. #undef NICE                     /* Be nice to other users during autorolling    */
  41. #define SATISFY_HUNGER         /* Do 'satisfy hunger' rather then 'create food'
  42.                                 to reduce the tedium for handling food. -CWS */
  43.  
  44.  
  45. /*****************************************************
  46.  * files used by moria, set these to valid pathnames *
  47.  *****************************************************/
  48.  
  49. /* Define OLD_FILEPATHS to use the old, nasty way of putting complete
  50.  * paths directly into Angband.  Define NEW_FILEPATHS to use the new,
  51.  * studly method (which uses the ANGBAND_PATH environment variable to
  52.  * look for the files).                                         [cjh]
  53.  */
  54.  
  55. #undef  OLD_FILEPATHS
  56. #define NEW_FILEPATHS
  57.  
  58.  
  59. /* Change this to something sensible, if necessary.  Angband will look
  60.  * in this directory if the ANGBAND_PATH environment variable isn't   
  61.  * set, or if the files aren't found in ANGBAND_PATH.            [cjh]
  62.  */
  63.  
  64. #ifdef NEW_FILEPATHS
  65. #ifdef AMIGA
  66. #define DEFAULT_PATH "Angband:"
  67. #else
  68. #define DEFAULT_PATH "/User/games/lib/angband"
  69. #endif
  70. #endif
  71.  
  72. #ifdef OLD_FILEPATHS
  73.  
  74. /* Try to fix filename inclusion in a portable fashion.
  75.  * John Whitly@cs.Buffalo.edu says this works under gcc 2.5.5, but my
  76.  * older version chokes.  I dunno. -CWS
  77.  */
  78.  
  79. #ifdef __STDC__
  80. #define LIBDIR(FILE) "/User/games/lib/angband/" #FILE
  81. #else
  82. #define LIBDIR(FILE) "/User/games/lib/angband/FILE"
  83. #endif
  84.  
  85. /* probably unix */
  86. #define ANGBAND_TST       LIBDIR(test)
  87. #define ANGBAND_HOU       LIBDIR(files/hours)
  88. #define ANGBAND_MOR       LIBDIR(files/news)
  89. #define ANGBAND_TOP       LIBDIR(files/newscores)
  90. #define ANGBAND_BONES     LIBDIR(bones)
  91. #define ANGBAND_HELP      LIBDIR(files/roglcmds.hlp)
  92. #define ANGBAND_ORIG_HELP LIBDIR(files/origcmds.hlp)
  93. #define ANGBAND_WIZ_HELP  LIBDIR(files/rwizcmds.hlp)
  94. #define ANGBAND_OWIZ_HELP LIBDIR(files/owizcmds.hlp)
  95. #define ANGBAND_WELCOME   LIBDIR(files/welcome.hlp)
  96. #define ANGBAND_LOG       LIBDIR(files/ANGBAND.log)
  97. #define ANGBAND_VER       LIBDIR(files/version.hlp)
  98. #define ANGBAND_LOAD      LIBDIR(files/loadcheck)
  99. #define ANGBAND_WIZ       LIBDIR(files/wizards)
  100. #define ANGBAND_SAV       LIBDIR(save)
  101. #endif /* OLD_FILEPATHS */
  102.  
  103.  
  104. /* this sets the default user interface
  105.  * to use the original key bindings (keypad for movement) set ROGUE_LIKE
  106.  * to FALSE, to use the rogue-like key bindings (vi style movement)
  107.  * set ROGUE_LIKE to TRUE
  108.  * if you change this, you only need to recompile main.c */
  109.  
  110. #define ROGUE_LIKE FALSE
  111.  
  112.  
  113. /* for the AFS distributed file system, define this to ensure that
  114.    the program is secure with respect to the setuid code, this prohibits
  115.    inferior shells, also does not relinquish setuid priviledges at the start,
  116.    but instead calls the AFS library routines bePlayer(), beGames(),
  117.    and Authenticate() */
  118.  
  119. /* #define SECURE */
  120.  
  121.  
  122. /* Note that any reasonably modern compiler does better when you *don't* use
  123.  * "register".  I've hacked it out here because I don't want to change every
  124.  * arg list in the game.  You might want to undo this if your compiler sucks.
  125.  *                   -CWS
  126.  */
  127.  
  128. #define register
  129.  
  130.  
  131. /* this allows intelligent compilers to do better, as they know more
  132.  * about how certain functions behave -CWS */
  133.  
  134. #if !(defined(__GNUC__) || defined(__STDC__))
  135. #define const
  136. #endif
  137.  
  138.  
  139. /* no system definitions are needed for 4.3BSD, SUN OS, DG/UX */
  140.  
  141. /* if you are compiling on an ultrix/4.2BSD/Dynix/etc. version of UNIX,
  142.    define this, not needed for SUNs */
  143. /* #ifndef ultrix
  144. #define ultrix
  145. #endif */
  146.  
  147. #if defined(SOLARIS)
  148. #define SYS_V
  149. #include <netdb.h>
  150. #endif
  151.  
  152. /* if you are compiling on a SYS V version of UNIX, define this */
  153. /* #define SYS_V */
  154.  
  155. /* if you are compiling on a SYS III version of UNIX, define this */
  156. /* #define SYS_III */
  157.  
  158. /* if you are compiling on an ATARI ST with Mark Williams C, define this */
  159. /* #define ATARIST_MWC */
  160.  
  161. /* if you are compiling on a Macintosh with MPW C 3.0, define this */
  162. /* #define MAC */
  163.  
  164. /* if you are compiling on a HPUX version of UNIX, define this */
  165. /* #define HPUX */
  166.  
  167. /****************************************************************************
  168.  * System dependent defines follow, you should not need to change anything  *
  169.  * below (if you have a supported system).  If you run into problems during *
  170.  * compilation, you might want to check the defines below.                  *
  171.  ****************************************************************************/
  172.  
  173. /* For the NEW_FILEPATHS option, we'll use PATH_SEP as the path separator;
  174.  * this will help make at least one section of Angband more portable.  If
  175.  * you don't seem something sensible here, either add a section for your
  176.  * filesystem, or just define PATH_SEP to something useful.          [cjh]
  177.  */
  178.  
  179. /* NOTE: This is 100% untested on all but Atari, UNIX, and OS/2...  I'm
  180.  *       guessing at the Mac and VMS PATH_SEP values!                [cjh]
  181.  */
  182.  
  183. #if defined(ultrix) || defined(SYS_V) || defined(SYS_III) \
  184.  || defined(__MINT__) || defined(HPUX) || defined(unix) \
  185.  || defined(BSD) || defined(AMIGA)
  186. #  define PATH_SEP "/"
  187. #else
  188. #  if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WINNT) \
  189.    || defined(ATARIST_MWC) || defined(ATARI) || defined(ATARIST)
  190. #    define PATH_SEP "\\"
  191. #  else
  192. #    ifdef MAC
  193. #      define PATH_SEP ":" /* or is it "::"? */
  194. #    else
  195. #      ifdef VMS
  196. #        define PATH_SEP "."
  197. #      endif /* VMS */
  198. #    endif /* Mac */
  199. #  endif /* DOS filesystems */
  200. #endif /* UNIX filesystems */
  201.  
  202.  
  203. /* Note that you'll be happier if you have a case-insensitive string
  204.  * comparision routine on your system.  If your system lacks this,
  205.  * you're still in luck, as we now provide one.  -CWS
  206.  */
  207.  
  208. #if defined (NeXT) || defined(HPUX) || defined(ultrix) \
  209. || defined(NCR3K) || defined(linux) || defined(ibm032) \
  210. || defined(__386BSD__) || defined(SOLARIS) || defined (__osf__)
  211. #define stricmp strcasecmp
  212. #else
  213. /* Let's make this work on systems lacking a such a routine. */
  214. #define stricmp my_stricmp
  215. #define NEEDS_STRICMP
  216. #endif
  217.  
  218.  
  219. /* this takes care of almost all "implicit declaration" warnings -CWS */
  220.  
  221. #if defined(NeXT)
  222. #include <libc.h>
  223. #else
  224. #include <unistd.h>
  225. #include <stdlib.h>
  226. #include <fcntl.h>
  227. #endif
  228.  
  229. #ifdef __MINT__
  230. #include <support.h>
  231. #endif
  232.  
  233.  
  234. /* fix systems lacking usleep() -CWS 
  235.  *
  236.  * Note that Solaris 2.x users without the BSD compatibilty kit need to
  237.  * define this as well.
  238.  */
  239.  
  240. #if defined(HPUX) || defined(ultrix)
  241. #define NEEDS_USLEEP
  242. #endif
  243.  
  244. #ifdef NEEDS_USLEEP
  245. #define usleep microsleep
  246.  
  247. #ifdef __STDC__
  248. int microsleep(unsigned long);
  249. #else
  250. int microsleep();
  251. #endif /* __STDC__ */
  252.  
  253. #endif
  254.  
  255.  
  256. /* substitute strchr for index on USG versions of UNIX */
  257. #if defined(SYS_V) || defined(MSDOS) || defined(MAC)
  258. #define index strchr
  259. #endif
  260.  
  261. #ifdef SYS_III
  262. char *index();
  263. #endif
  264.  
  265. #if defined(SYS_III) || defined(SYS_V) || defined(MSDOS) || defined(MAC) || defined(HPUX)
  266. #ifndef USG
  267. #define USG
  268. #endif
  269. #endif
  270.  
  271. #if defined(ATARIST_MWC) || defined (__MINT__)
  272. #ifndef USG
  273. #define USG
  274. #endif
  275. #endif
  276.  
  277. /* Pyramid runs 4.2BSD-like UNIX version */
  278. #if defined(Pyramid)
  279. #define ultrix
  280. #endif
  281.  
  282. #ifdef MSDOS
  283. #define register      /* MSC 4.0 still has a problem with register bugs ... */
  284. #endif
  285.  
  286. #ifdef MAC
  287. #ifdef RSRC
  288. #define MACRSRC        /* i.e., we're building the resources */
  289. #else
  290. #define MACGAME        /* i.e., we're building the game */
  291. #endif
  292. #endif
  293.  
  294. #ifdef MAC
  295. /* Screen dimensions */
  296. #define SCRN_ROWS    24
  297. #define SCRN_COLS    80
  298. #endif
  299.  
  300. #if vms
  301. #define getch _getch
  302. #define unlink delete
  303. #define index strchr
  304. #define lstat stat
  305. #define exit uexit
  306. #endif
  307.  
  308. #if defined(SYS_V) && defined(lint)
  309. /* to prevent <string.h> from including <NLchar.h>, this prevents a bunch
  310.    of lint errors. */
  311. #define RTPC_NO_NLS
  312. #endif
  313.  
  314. #ifdef SECURE
  315. extern int PlayerUID;
  316. #define getuid() PlayerUID
  317. #define geteuid() PlayerUID
  318. #endif
  319.  
  320.  
  321. /*****************************************************************************/
  322.  
  323. /* Here's some functions that've been macroized rather than being called
  324.  * from everywhere.  They're short enough so that inlining them will probably
  325.  * result in a smaller executable, and speed things up, to boot. -CWS
  326.  */
  327.  
  328. #define MY_MAX(a,b) ((a) > (b) ? (a) : (b))
  329. #define MY_MIN(a,b) ((a) < (b) ? (a) : (b))
  330.  
  331.  
  332. /* Checks a co-ordinate for in bounds status        -RAK-    */
  333.  
  334. #define in_bounds(y, x) \
  335.    ((((y) > 0) && ((y) < cur_height-1) && ((x) > 0) && ((x) < cur_width-1)) ? \
  336.     (TRUE) : (FALSE))
  337.  
  338.  
  339. /* Checks if we can see this point (includes map edges) -CWS */
  340. #define in_bounds2(y, x) \
  341.    ((((y) >= 0) && ((y) < cur_height) && ((x) >= 0) && ((x) < cur_width)) ? \
  342.     (TRUE) : (FALSE))
  343.  
  344.  
  345. /* Tests a given point to see if it is within the screen -RAK-
  346.  * boundaries.
  347.  */
  348.  
  349. #define panel_contains(y, x) \
  350.   ((((y) >= panel_row_min) && ((y) <= panel_row_max) && \
  351.     ((x) >= panel_col_min) && ((x) <= panel_col_max)) ? (TRUE) : (FALSE))
  352.  
  353.  
  354. /* Generates a random integer X where 1<=X<=MAXVAL    -RAK-    */
  355.  
  356. #define randint(maxval) (((maxval) < 1) ? (1) : ((random() % (maxval)) + 1))
  357.  
  358. /* You would think that most compilers can do an integral abs() quickly,
  359.  * wouldn't you?  Nope.  [But fabs is a lot worse on most machines!] -CWS
  360.  */
  361.  
  362. #define MY_ABS(x) (((x)<0) ? (-x) : (x))
  363.  
  364. /*****************************************************************************/
  365.